import 'package:base_plugin/base_plugin.dart';
import 'package:dio/dio.dart';

/// 仪表板
class HttpDashboardService {
  /// 我的仪表板
  static Future<Response> dashboard() {
    return BaseConfig.httpBase.get('/api/dashboard', {});
  }

  /// 费用仪表板
  static Future<Response> dashboardExpenses() {
    return BaseConfig.httpBase.get('/api/dashboard/expenses', {});
  }

  /// 盈利模板仪表板
  static Future<Response> dashboardProfits() {
    return BaseConfig.httpBase.get('/api/dashboard/profits', {});
  }

  /// 交易记录
  static Future<Response> dashboardTransaction(int page) {
    return BaseConfig.httpBase.get('/api/transactions', {'page': page});
  }

  /// 联络记录
  static Future<Response> dashboardContacts(int page) {
    return BaseConfig.httpBase.get('/api/dashboard/contacts', {'page': page});
  }

  /// 概述
  static Future<Response> dashboardOverview(int page) {
    return BaseConfig.httpBase.get('/api/dashboard/overview', {'page': page});
  }

  /// 采购概述
  static Future<Response> dashboardPurchases() {
    return BaseConfig.httpBase.get('/api/dashboard/purchases', {});
  }

  static Future<Response> dashboardBills() {
    return BaseConfig.httpBase.get('/api/dashboard/bills', {});
  }

  /// Expense概述
  static Future<Response> dashboardPurchaseExpenses() {
    return BaseConfig.httpBase.get('/api/dashboard/expenses/total', {});
  }

  /// 销售概述
  static Future<Response> dashboardSales() {
    return BaseConfig.httpBase.get('/api/dashboard/sales', {});
  }

  /// 销售图表
  static Future<Response> dashboardSalesOverview(String time) {
    return BaseConfig.httpBase.get('/api/dashboard/overview', {
      'time': time,
    });
  }

  /// 账号概述
  static Future<Response> dashboardAccount(
      {int accountId, String start_date, String end_date}) {
    return BaseConfig.httpBase.get('/api/dashboard/accounts', {
      'account_id': accountId,
      'start_date': start_date,
      'end_date': end_date,
    });
  }

  /// 偿还概述
  static Future<Response> dashboardReimburses() {
    return BaseConfig.httpBase.get('/api/dashboard/reimburses', {});
  }
}
